<template>
  <base-layout
     :dialog-title="dialogTitle"
    :dialog-visible="dialogVisible"
    dialog-width="600px"
    :page-show="pageShow"
    @dialog-close="dialogClose"
  >
    <template #toolPanel />
    <template #searchPanel>
      <search-panel  @search="search" :show-search-button="true" :showAddButton="false" :left="true">
        <el-form-item label="省份名称:">
          <el-input v-model="filters.provincename" clearable style="width: 200px" placeholder="名称" />
        </el-form-item>
        <el-form-item label="省份代码:">
          <el-input v-model="filters.provincecode" clearable style="width: 200px" placeholder="代码" />
        </el-form-item>
<!--            <el-form-item label="省份状态:">-->
<!--              <el-input v-model="filters.provincestatus" maxlength="100" clearable />-->
<!--            </el-form-item>-->
      </search-panel>
    </template>
    <template #contentPanel>
      <data-table
        :value="tableData"
        :total-count="totalCount"
        :has-action="false"
        :current="start"
        :table-column-attributes="tableColumnAttributes"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
        <template #action="{row}">
        </template>
      </data-table>
    </template>

    <template #dialog>
      <dialog-data-form :value="dialogData"  @operate="handleDataOperate"/>
    </template>

  </base-layout>
</template>

<script>
import baseMixin from '@/mixins/base'
import DialogDataForm from './components/DialogDataForm'
import { searchProvince } from '@/api/utilsapi'

export default {
  name: 'homeAdv',
  components: { DialogDataForm },
  mixins: [
    baseMixin({
      idName: 'id',
      findData: searchProvince,
      format(res) {
        return res.map(data => {
          return data
        })
      }
    })
  ],
  data() {
    return {
      pageShow: true,
      dialogData:{},
      tableColumnAttributes: [
        { name: '省份名称', value: 'provincename' },
        { name: '省份代码', value: 'provincecode' },
        { name: '省份状态', value: 'provincestatus' },
        { name: '创建时间', value: 'createtime'},
      ],
      filters: {
        provincecode:'',
        provincename:''
      }
    }
  },
  methods: {
    search(form){
      let para = {
        provincename: this.filters.provincename,
        start: 0,
        pageSize: 10,
        provincecode: this.filters.provincecode,
      };
      this.searchOptions = para;
      this.setTableData()
    },
  }
}
</script>
